﻿using Msg.Api.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace Msg.Api.Controllers
{
    /// <summary>
    /// 所有ApiController基类
    /// </summary>
    [APIActionFilter]
    [APIExceptionFilter]
    public class BaseApiController : ApiController
    {
        /// <summary>
        /// 当前登陆人
        /// </summary>
        protected string CurrentUser
        {
            get
            {
                return this.ActionContext.RequestContext.Principal.Identity.Name;
            }
        }

        /// <summary>
        /// 判断是是否为空类型
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        protected bool IsNullOrDbNull(object obj)
        {
            return obj == null || obj == DBNull.Value;
        }
    }
}
